import { createApp } from 'vue'
// import './style.css'
import App from './App.vue'
import router from './router'
import api from './api'
import { Dialog } from 'vant'

const app = createApp(App)

//在vue实例上挂载api对象
app.config.globalProperties.$api = api


//未登录进入页面时闪烁
router.beforeEach((to, from) => {
  if (to.path !== '/login') {
      if (!localStorage.getItem('h5_token')) {
        return '/login'
    }
  }
})

//路由挂载
app.use(router)
app.mount('#app')
app.use(Dialog)
